use core::fmt;
// use std::{fs::Permissions, path::Display};

enum GenderT{
    Man,
    Women
}

enum StatusT{
    Normal,
    Skinny,
    OverWeight
}

struct Person{
    name: String,
    age : i32,
    weight_kg :f32,
    height_m :f32,
    gender :GenderT
}

impl Person{
    fn BMI(&self)->f32{
        &self.weight_kg/&self.height_m/&self.height_m
    }
}

impl fmt::Display for StatusT{
    fn fmt(&self, f : &mut fmt::Formatter) -> fmt::Result {
        if self == StatusT::Normal
        {
            write!(f,"Normal")
        }
        else if self == StatusT::Skinny
        {
            write!(f,"Skinny")
        }
        else {
            write!(f,"OverWeight")
        }
    }
}

impl fmt::Display for Person{
    fn fmt(&self, f : &mut fmt::Formatter) -> fmt::Result {
        write!(f,"Person name:{},BMI:{}",self.name,self.BMI())
    }
}
fn main() {
    let charx = Person{
        name : String::from("CharX"),
        age : 22,
        weight_kg : 67.5,
        height_m: 1.668,
        gender : GenderT::Man
    };
    let cond=vec![1,2,3,4,5];
    let d_cond:Vec<i32>=cond.iter().map(|x| 2*x).collect();
    let numbers = vec![1, 2, 3, 4, 5, 6];

    // 使用 iter()，保留偶数但不消耗原始集合
    let even_numbers: Vec<&i32> = numbers.iter()
                                         .filter(|&&x| x % 2 == 0)
                                         .collect();
    println!("{:?},{:?}",d_cond,even_numbers);
    println!("{}",charx);
    println!("Hello, world!");
}
